#pragma once
#include <QTcpServer>
#include "HiFileTransferDef.h"

class HiFileReceiverServer : public QTcpServer
{
    Q_OBJECT
public:
    explicit HiFileReceiverServer(QObject* parent = nullptr);
    ~HiFileReceiverServer();

public:
    void setSavePaths(const QStringList& savePaths);
    void setMinReaminSize(qint64 minReaminSize);

protected:
    void incomingConnection(qintptr socketDescriptor) override;

signals:
    void signalReceiveDataSize(const QString& ip, const qint64 nSize);
    void signalFileReceiveFinished(const QString& ip, const QString& filePath, const QByteArray& userData);
    void signalReceiveStart(const QString& ip);
    void signalReceiveError(const QString& ip, HiFileTransferDef::eRecevieError);

private:
    QStringList mSavePaths;
    qint64 mMinReaminSize = 0;
};